import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
import set from '@dfeidao/atom-mobile/local/set';
import nodejs from '@dfeidao/atom-mobile/msg/nodejs';
import render from '@dfeidao/atom-mobile/render/render';
import whoami_getparams from '../atom/whoami_getparams';

export default async function a001(fd: IFeidaoAiMobile) {
	const users = await whoami_getparams(fd) as { userinfo: object, params: object };
	// console.log(users, '--------users系统参数--------');

	const user_whoami = users.userinfo as { productid: string, usercode: string, user_name: string };
	const productid = user_whoami.productid;
	set(fd, "productid", productid);

	const params = users.params as { teacher_name: string, teacher_no: string, productid: string };
	const teacher_no = params.teacher_no;
	set(fd, 'teacher_no', teacher_no);

	const page_no = 1;
	const res = await nodejs<Array<{}>>('app-leave-record/s001', { teacher_no, productid, page_no });// 依据"教师编号"查询<教师请假>表
	// console.log(res, '-------res-----------');

	set(fd, 'res', res);
	render(fd, { dt: res, page_no, new_len: res.length });
}
